package com.zyk.leetcode;

/**
 * @author zhangsan
 * @date 2021/4/19 9:26
 */
public class C27 {

    // https://leetcode-cn.com/problems/remove-element/
    public static int removeElement(int[] nums, int val) {
        int n = nums.length;
        int left = 0;
        for (int right = 0; right < n; right++) {
            if (nums[right] != val) {
                nums[left] = nums[right];
                left++;
            }
        }
        return left;
    }


    // for test
    public static void main(String[] args) {

    }

}
